﻿using Common.DataModels;

namespace Extensions.Services.Authentication.Policys;



public enum StatusCode
{
    CODE200,
    CODE401,
    CODE403,
    CODE404,
    CODE500
}
public class TokenValidateModel
{
    public int Code { get;  } = 200;
    public string Msg { get;  } = "";
    public MessageModel<string?> MessageModel { get; }

    public TokenValidateModel(StatusCode apiCode, string msg = null)
    {
        switch (apiCode)
        {
            case StatusCode.CODE401:
            {
                Code = 401;
                Msg = "很抱歉，您无权访问该接口，请确保已经登录!";
            }
                break;
            case StatusCode.CODE403:
            {
                Code = 403;
                Msg = "很抱歉，您的访问权限等级不够，联系管理员!";
            }
                break;
            case StatusCode.CODE404:
            {
                Code = 404;
                Msg = "资源不存在!";
            }
                break;
            case StatusCode.CODE500:
            {
                Code = 500;
                Msg = msg;
            }
                break;
        }

        MessageModel = new MessageModel<string?>("", apiCode != StatusCode.CODE200, Code, Msg);
    }
}